package Cowquisition;

import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;


/**
 * Class: Tile
 * Defines a tile.
 */
public class Tile
{
  /**
   * The types of land the an instantiation of the Tile class could represent.
   */
  public enum landType {GRASS, WATER, DIRT, FLOOR, LAVA, SAND, SWAMP, COW, GENTYPE}
  /**
   * The types of object that could be on the tile.
   */
  public enum objectType {AIR,TREE,ROCK}
  /**
   * The landType of the instantiated Tile.
   */
  landType type;
  /**
   * Specifies whether the user can walk on the Tile.
   */
  boolean walkable;
  /**
   * The image for the Tile.
   */
  BufferedImage tileImage;


  /**
   * Constructor
   * 
   * @param typein The landType of the Tile.
   * @param imageFileName The filename for the Tile image.
   * @param walkIn Tells whether the user can walk on the Tile.
   */
  public Tile(landType typeIn, File imageFile, boolean walkIn)
  {
    try
    {
      tileImage = ImageIO.read(imageFile);
    }
    catch(IOException e)
    {
      System.out.println("NO IMAGE FILE.");
    }

    type = typeIn;
    walkable = walkIn;
  }

  /**
   * getImage method
   *
   * @return Returns the image representing the Tile
   */
  public BufferedImage getImage()
  {
    return tileImage;
  }

  /**
   * canWalk method
   *
   * @return Returns true if an entity can walk on the Tile
   */
  public boolean canWalk()
  {
    return walkable;
  }

  /**
   * getType method
   *
   * @return The landType of the Tile object
   */
  public landType getType()
  {
    return type;
  }
}
